package com.springboot.controller;

import com.springboot.domain.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/hc")
public class HelloController {
    @Value("${hqj.name}")
    private String name;
    @Value("${hqj.password}")
    private String password;

    Logger logger = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);

    @RequestMapping("/hello")
    public String hello(){
        System.out.println("name:"+name+",password:"+password);
        logger.debug("debug日志输出 ");
        logger.info("输出日志信息");
        logger.error("异常日志信息");
        return "Hello Springboot";
    }

    @RequestMapping("/getUser")
    public User getUser(){
        User u = new User();
        u.setName("hqj");
        u.setSex("男");
        u.setAge(28);
        u.setHeight(1.73);
        return u;
    }
}
